<div id="headlines">
	<h2>Tabla de posiciones</h2>
	<div id="tables">
		<ul>
			<?php
			$this -> load -> model('Torneo_Model');
			$count_tab = 1;
			foreach($tournaments as $row) {
				echo "<li>";
				echo '<a href="#tables-'.$count_tab.'">';
				echo $row->tournament_name;
				echo "</a>";
				echo "</li>";
				$count_tab++;
			}
			?>
		</ul>
		
		<?php

			$count_tab = 1;
			foreach($tournaments as $row) { 
				echo '<div id="tables-'.$count_tab.'">';
				echo '<ul>';
				?>
					
				<?php 
				//echo "tournament tab =" . $row->tournament_id 
				$teams = $this -> Torneo_Model -> get_teams_on_tournament($row->tournament_id);
				//$matches = $this -> Torneo_Model -> get_matches_by_tournament_id($row->tournament_id);
				?>
				<li>
				<table id="tomala" class="position">
					
					<tr>
						<!--<td>POS</td> -->
						<th>Equipo</th>
						<th>Pts.</th>
						<th>PJ</th>
						<th>G</th>
						<th>E</th>
						<th>P</th>
						<th>GF</th>
						<th>GC</th>
						<th>Dif.</th>
					</tr>
				<?php
				foreach ($teams as $team ) {
					$statistic_team = $this -> Torneo_Model -> get_team_statistics($team->team_id,$row->tournament_id);
					//print_r($statistic_team);
					echo "<tr>";
					echo '<!--<td>0</td>-->';
					echo '<td>'.$team->team_name.'</td>';
					echo '<td>'.$statistic_team['pts'].'</td>';
					echo '<td>'.$statistic_team['PJ'].'</td>'; //puntos
					echo '<td>'.$statistic_team['PG'].'</td>'; // ganados
					echo '<td>'.$statistic_team['PE'].'</td>';
					echo '<td>'.$statistic_team['PP'].'</td>';
					echo '<td>'.$statistic_team['GF'].'</td>';
					echo '<td>'.$statistic_team['GC'].'</td>';
					echo '<td>'.$statistic_team['dif'].'</td>';
					echo '</tr>';				
				}
				echo '</li>';
				echo '</ul>';
				echo '</table>';
				echo '</div>';
				$count_tab++;	} ?>
		
		<!--
		<div id="tables-1">
			<p>
				Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
			</p>
		</div>
		<div id="tables-2">
			<p>
				Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.
			</p>
		</div> -->
		
	</div>
	
	<!--
	<h2>headlines</h2>
	<ul class="list-1">
		<li>
			<strong>JUL 18, 2010</strong>
			<a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a>
		</li>
		<li>
			<strong>JUL 18, 2010</strong>
			<a href="#">Nibh euismod tincidunt ut laoreet</a>
			<span>dolore magna aliquam erat volutpat </span>
		</li>
		<li>
			<strong>JUL 17, 2010</strong>
			<a href="#">Ut wisi enim ad minim veniam</a>
			<span>quis nostrud exerci tation </span>
		</li>
		<li>
			<strong>JUL 17, 2010</strong>
			<a href="#">Ullamcorper suscipit lobortis</a>
			<span>nisl ut aliqui ex ea commodo consequat</span>
		</li>
		<li>
			<strong>JUL 13, 2010</strong>
			<a href="#">Duis autem vel eum iriure dolor in</a>
			<span>hendrerit in vulputate velit esse</span>
		</li>
		<li>
			<strong>JUL 13, 2010</strong>
			<a href="#">Nibh euismod tincidunt ut laoreet</a>
			<span>dolore magna aliquam erat volutpat</span>
		</li>
	</ul>
	-->
	<div class="link">
		<a href="#">read more</a>
	</div> 
</div>